home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / MATHS / ARCAUT / Automatons / Diffuse < prev    next >
Text File  |  1991-07-27  |  1KB  |  47 lines

  1. AUTOMATON*
  2.  
  3.   Diffuse
  4.  
  5.   'Hot' & 'cold' lines & circles are scattered over the background. Diffuse
  6.   then proceeds to evolve the picture in a manner similar to the way that
  7.   heat would be conducted through a medium, with different colours
  8.   corresponding to different temperatures; white is hot & black, cold. The
  9.   initial hot & cold regions maintain their temperature, acting as heat
  10.   sources & sinks. Eventually a static pattern is reached. Try a 200x100
  11.   window.
  12.  
  13. INITIALISATION*
  14.  
  15.   10DEF PROCdo
  16.   20*SetEval wrap on
  17.   30ENDPROC
  18.  
  19. SCREEN*
  20.  
  21.   10DEF PROCdo 
  22.   20DIM buf% 256
  23.   30SYS "OS_ReadVarVal","sux",buf%,256:sux%=!buf%
  24.   40SYS "OS_ReadVarVal","suy",buf%,256:suy%=!buf%
  25.   50GCOL 128+32 TINT 128:CLG
  26.   60GCOL 0 TINT 0
  27.   70FOR Q%=1TO RND(4)+5:PROClin:NEXT
  28.   80FOR Q%=1TO RND(3):PROCcir:NEXT
  29.   90GCOL 63 TINT 255
  30.  100FOR Q%=1TO RND(4)+5:PROClin:NEXT
  31.  110FOR Q%=1TO RND(3):PROCcir:NEXT
  32.  120ENDPROC
  33.  130DEF PROClin
  34.  140MOVE RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2:DRAW BY RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2
  35.  150ENDPROC
  36.  160DEF PROCcir
  37.  170CIRCLE FILL RND(sux%*4)-sux%*2,RND(suy%*4)-suy%*2,RND(SQR(sux%*suy%/PI))/5
  38.  180ENDPROC
  39.  
  40. CODE*
  41.  
  42. ( CELL   0 = IF (  0 ==)
  43.   CELL 255 = IF (255 ==)
  44.   READ_NEIG
  45.   SUM_NEIG 4 + 3 >>  ==  )
  46.  
  47. END*